# 一个标准的python脚本的写法
# 最上面写导入模块的语句
import Demo3


# 其次写定义的类
class High_school_student():
    # 这里相当于成员变量和构造方法写在一起了
    def __init__(self, name, age, gender):
        # 在变量前面加上__,表示将该变量变成私有的
        # self.__name = name
        self.name = name
        self.age = age
        self.gender = gender

    def missing_age(self):
        if self.age == '':
            print("该学生年龄有误")
        else:
            print("该学生的年龄为：%s" % self.age)

    print("shujia")

    # 获取成员信息
    def show(self):
        print("姓名：%s,年龄：%s,性别：%s" % (self.name, self.age, self.gender))

    # def getName(self):
    #     return self.__name


class Man_student(High_school_student):
    # pass
    def show(self):
        print("这是子类中的show方法")


# 创建对象
# student1 = High_school_student('小虎', 18, '男')
# student1.show()
# student1.missing_age()
# # print(student1.name)
# # print(student1.getName())
# print(student1.age)
# print(student1.gender)


def sum(x, y):
    return x + y


# 表示这是python程序的入口，相当于java中的main方法
if __name__ == '__main__':
    # 创建对象
    student1 = High_school_student('小虎', 18, '男')
    student1.show()
    print(sum(10, 20))
    # 打印50个*
    print('*' * 50)

    student2 = Man_student('黄少虎', 18, '男')
    # 如果子类有和父类中的函数名一样的话，调用的是子类中的函数
    student2.show()
    student2.missing_age()
    # sum(10,'dasdas')
    list = [1, 2, 3, 4, 5]

    try:
        print(list[10])
    except:
        print("取了不该取的索引")
    else:
        print("这是else的语句")
    finally:
        print("无论包不报错都会执行")

    print("数加科技")


